package com.hctrl.mybatis.service.impl;

import com.hctrl.mybatis.entity.UserDO;
import com.hctrl.mybatis.mapper.UserMapper;
import com.hctrl.mybatis.service.UserService;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService, SmartInitializingSingleton {

    @Autowired
    private UserMapper userMapper;

    @Override
    public UserDO selectById(Long id) {
        return userMapper.selectById(id);
    }

    @Override
    public List<UserDO> selectBySex(String sex) {
        return userMapper.selectBySex(sex);
    }

    @Override
    public List<UserDO> selectByCondition(String name, Integer age) {
        return userMapper.selectByCondition(name,age);
    }

    @Override
    public UserDO selectByMap(UserDO user) {
        return userMapper.selectByMap(user);
    }

    @Override
    public void afterSingletonsInstantiated() {
        System.out.println("UserServiceImpl 注入成功");
    }
}
